include ../config.mak

TAGGER=TimeTagger.o Thread.o HWClock.o Logger.o Control.o
TOOLS=Histogram.o Iterator.o Pulsed.o CountBetweenMarkers.o Counter.o Histogram2.o

ifdef EMULATION
FPGALIB=okFrontPanelEmulator.o
else
FPGALIB=okFrontPanelDLL.o
endif



all: backend.a _backend.so

clean:
	rm -f *.o _TimeTagger.so *~ *pyc backend.cxx gmon.out backend.py _backend.so backend.a

backend.a: $(TAGGER) $(TOOLS) $(FPGALIB) 
	ar r $@ $? 

%.o: %.cpp
	g++ -c $(CFLAGS)  $<

okFrontPanelDLL.o: ../okFrontPanel/okFrontPanelDLL.cpp
	g++ $(CFLAGS) -c -o $@ $< 

okFrontPanelEmulator.o: ../okFrontPanel/okFrontPanelEmulator.cpp
	g++ $(CFLAGS) -c -o $@ $< 

backend_wrap.cxx: backend.i TimeTagger.h $(TOOLS)
	swig -classic -Wall -c++ -python backend.i

backend_wrap.o: backend_wrap.cxx
	g++ -c $(CFLAGS) $<

_backend.so: backend_wrap.o backend.a
	g++ -shared $^ -o _backend.so $(LFLAGS)
